﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using Microsoft.WindowsAzure.ServiceRuntime;
using Microsoft.WindowsAzure.StorageClient;
using Microsoft.WindowsAzure;

namespace CPlase
{
    public static class Engine
    {
        public static bool IsDevMode
        {
            get
            {
                //var StorageAccount = Azure.GetStorageAccount();
                var ConnectionString = RoleEnvironment.IsEmulated ?
                    RoleEnvironment.GetConfigurationSettingValue("EmulatedConnectionString")
                    : RoleEnvironment.GetConfigurationSettingValue("ConnectionString");
                return ConnectionString == "UseDevelopmentStorage=true";
                //return StorageAccount == CloudStorageAccount.DevelopmentStorageAccount;
            }
        }

        public static bool IsDevelopment
        {
            get
            {
                return Environment == "Development";
            }
        }

        public static bool IsBeta
        {
            get
            {
                return Environment == "Beta";
            }
        }

        public static string Environment
        {
            get
            {
                string Environment = "Release";
                try
                {
                    Environment = RoleEnvironment.GetConfigurationSettingValue("CPlaseEnvironment");
                }
                catch { }
                return Environment;
            }
        }

    }
}
